From 30e49102ed25096d3cd7e431651b8220a2463b18 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Thu, 15 Dec 2005 18:38:49 +0000 Subject: [PATCH] Split talk_to_otherend into two pieces, one for getting the otherend details, and one for registering the watch on the otherend's path. This means that we get the fix intended by xen-unstable changeset 8370:39a616126104 (i.e. we only register the watch once drv->probe() has succeeded), but without breaking block devices. Signed-off-by: Ewan Mellor --- .../drivers/xen/xenbus/xenbus_probe.c | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index ea09e35700..72e81712d8 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -315,15 +315,16 @@ static void otherend_changed(struct xenbus_watch *watch, static int talk_to_otherend(struct xenbus_device *dev) { struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver); - int err; free_otherend_watch(dev); free_otherend_details(dev); - err = drv->read_otherend_details(dev); - if (err) - return err; + return drv->read_otherend_details(dev); +} + +static int watch_otherend(struct xenbus_device *dev) +{ return xenbus_watch_path2(dev, dev->otherend, "state", &dev->otherend_watch, otherend_changed); } @@ -349,14 +350,22 @@ static int xenbus_dev_probe(struct device *_dev) goto fail; } + err = talk_to_otherend(dev); + if (err) { + printk(KERN_WARNING + "xenbus_probe: talk_to_otherend on %s failed.\n", + dev->nodename); + return err; + } + err = drv->probe(dev, id); if (err) goto fail; - err = talk_to_otherend(dev); + err = watch_otherend(dev); if (err) { printk(KERN_WARNING - "xenbus_probe: talk_to_otherend on %s failed.\n", + "xenbus_probe: watch_otherend on %s failed.\n", dev->nodename); return err; } @@ -826,6 +835,14 @@ static int resume_dev(struct device *dev, void *data) return err; } + err = watch_otherend(xdev); + if (err) { + printk(KERN_WARNING + "xenbus_probe: resume (watch_otherend) %s failed: " + "%d.\n", dev->bus_id, err); + return err; + } + if (drv->resume) err = drv->resume(xdev); if (err) -- 2.30.2